module.exports = function (mongoose, Schema, ObjectId) {
  let blogSchema = new Schema({
    enble: {
      type: Boolean,
      default: true
    },
    name: {
      type: String,
      required: true,
      maxlength: [10, '名称太长了。']
    },
    desc: {
      type: String,
      maxlength: [30, '描述太长了。']
    },
    owner: {
      type: ObjectId,
      ref: 'User',
      required: true
    },
    createdAt: {
      type: Date,
      default: Date.now
    }
  })

  return mongoose.model('Blog', blogSchema)
}
